<script setup>

import QAItem from '@/components/QAItem.vue'
import { ref } from 'vue'
import QAForm from '@/components/QAForm.vue'
import { useRouter } from 'vue-router'

const router = useRouter()
/*发布问题*/
const handleCancel = () => {
}
const handleConfirm = (question) => {
  console.log('问题：', question)
  //TODO 发送请求
  ElMessage.success('提交成功')
}
const qaForm = ref()
const openQA = () => {
  qaForm.value.QADialog = true
}
const goDoctor = () => {
  router.push('/doctor')
}
</script>

<template>
  <div class="QA">
    <div class="QA-box">
      <el-button color="#39c5bb" icon="EditPen" plain round size="large" @click="openQA">发布问题</el-button>
      <el-button color="#39c5bb" icon="Notebook" plain round size="large" @click="goDoctor">查看医师</el-button>
      <div v-for="item in 10">
        <QAItem></QAItem>
      </div>
    </div>
  </div>
  <QAForm ref="qaForm" @cancel="handleCancel" @confirm="handleConfirm"></QAForm>
</template>

<style lang="scss" scoped>
.QA {
  width: 100%;
  display: flex;
  justify-content: center;
  padding-top: 30px;

  &-box {
    width: 80%;
  }
}
</style>